import Vue from 'vue'
import Router from 'vue-router'
import Nav from '@/admin/nav'
import login from '@/admin/login'
import loginfail from '@/admin/loginfail'
import redirect from '@/admin/redirect'
import system from '@/admin/system/system'
import list from '@/admin/system/list'
import menu from '@/admin/system/menu'
import role from '@/admin/system/role'
import viewRight from '@/admin/system/viewRight'
import modifyRight from '@/admin/system/modifyRight'
import config from '@/admin/system/config'
import blank from '@/admin/forum/blank'
import newsDetail from '@/admin/forum/newsDetail'
import newsList from '@/admin/forum/newsList'
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/index',
      name: '首页',
      component: Nav,
      children: [{
        path: 'system',
        name: '系统设置',
        component: system
      }]
    },
    {
      path: '/redirect',
      component: redirect
    },
    {
      path: '/admin',
      component: blank,
      children: [
        {
          path: 'login',
          component: login
        },
        {
          path: 'loginfail/:type',
          component: loginfail
        },
        {
          path: 'index/:id',
          name: '首页',
          redirect: '/admin/index',
          component: Nav
        }
      ]
    },
    {
      path: '/admin/index',
      name: '首页',
      component: Nav,
      children: [
        {
          path: 'system',
          name: '系统设置',
          redirect: '/admin/index/system/list/:id',
          component: system,
          children: [
            {
              path: 'list/:id',
              name: '团队管理员列表',
              component: list
            },
            {
              path: 'menu/:id',
              name: '菜单管理',
              component: menu
            },
            {
              path: 'role/:id',
              name: '角色管理',
              component: role
            },
            {
              path: 'viewRight/:mid',
              name: '查看详情',
              component: viewRight
            },
            {
              path: 'modifyRight/:rid',
              name: '设置权限',
              component: modifyRight
            },
            {
              path: 'config/:id',
              name: '配置项记录',
              component: config
            }
          ]
        },
        {
          path: 'news',
          name: '新闻管理',
          component: blank,
          redirect: '/admin/news/list/:id',
          children: [
            {
              path: 'list/:id',
              name: '新闻列表',
              component: newsList
            },
            {
              path: 'editor',
              name: '编辑新闻',
              component: newsDetail
            }
          ]
        }
      ]
    }
  ]
})
